package com.jianglin.mapper;

import com.jianglin.model.ComplaintType;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper

public interface ComplaintTypeMapper {
    @Select("SELECT * FROM complaint_type WHERE id = #{id}")
    ComplaintType findById(Integer id);

    @Select("SELECT * FROM complaint_type")
    List<ComplaintType> findAll();

    @Insert("INSERT INTO complaint_type (name, remarks, status) " +
            "VALUES (#{name}, #{remarks}, #{status})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(ComplaintType complaintType);

    @Update("UPDATE complaint_type SET name=#{name}, remarks=#{remarks}, status=#{status} " +
            "WHERE id=#{id}")
    int update(ComplaintType complaintType);

    @Delete("DELETE FROM complaint_type WHERE id = #{id}")
    int delete(Integer id);

}
